3D Graphics Programming with QuickDraw 3D 1.5.4

Previous | QD3D Book | Overview | Chapter Contents | Next

Creating and Editing Triangles

QuickDraw 3D provides routines that you can use to create and manipulate triangles. See "Triangles" for the definition of a triangle.

Q3Triangle_New

You can use the Q3Triangle_New function to create a new triangle.

TQ3GeometryObject Q3Triangle_New (
                     const TQ3TriangleData *triangleData);
triangleData
A pointer to a TQ3TriangleData structure.

DESCRIPTION

The Q3Triangle_New function returns, as its function result, a new triangle having the vertices and attributes specified by the triangleData parameter. If a new triangle could not be created, Q3Triangle_New returns the value NULL .

Q3Triangle_Submit

You can use the Q3Triangle_Submit function to submit an immediate triangle for drawing, picking, bounding, or writing.

TQ3Status Q3Triangle_Submit (
                     const TQ3TriangleData *triangleData,
                     TQ3ViewObject view);
triangleData
A pointer to a TQ3TriangleData structure.
view
A view.

DESCRIPTION

The Q3Triangle_Submit function submits for drawing, picking, bounding, or writing the immediate triangle whose shape and attribute set are specified by the triangleData parameter. The triangle is drawn, picked, bounded, or written according to the view characteristics specified in the view parameter.

SPECIAL CONSIDERATIONS

You should call this function only in a submitting loop.

Q3Triangle_GetData

You can use the Q3Triangle_GetData function to get the data that defines a triangle and its attributes.

TQ3Status Q3Triangle_GetData (
                     TQ3GeometryObject triangle,
                     TQ3TriangleData *triangleData);
triangle
A triangle.
triangleData
On exit, a pointer to a TQ3TriangleData structure that contains information about the triangle specified by the triangle parameter.

DESCRIPTION

The Q3Triangle_GetData function returns, through the triangleData parameter, information about the triangle specified by the triangle parameter. QuickDraw 3D allocates memory for the TQ3TriangleData structure internally; you must call Q3Triangle_EmptyData to dispose of that memory.

Q3Triangle_SetData

You can use the Q3Triangle_SetData function to set the data that defines a triangle and its attributes.

TQ3Status Q3Triangle_SetData (
                     TQ3GeometryObject triangle,
                     const TQ3TriangleData *triangleData);
triangle
A triangle.
triangleData
A pointer to a TQ3TriangleData structure.

DESCRIPTION

The Q3Triangle_SetData function sets the data associated with the triangle specified by the triangle parameter to the data specified by the triangleData parameter.

Q3Triangle_EmptyData

You can use the Q3Triangle_EmptyData function to release the memory occupied by the data structure returned by a previous call to Q3Triangle_GetData .

TQ3Status Q3Triangle_EmptyData (TQ3TriangleData *triangleData);
triangleData
A pointer to a TQ3TriangleData structure.

DESCRIPTION

The Q3Triangle_EmptyData function releases the memory occupied by the TQ3TriangleData structure pointed to by the triangleData parameter; that memory was allocated by a previous call to Q3Triangle_GetData .

Q3Triangle_GetVertexPosition

You can use the Q3Triangle_GetVertexPosition function to get the position of a vertex of a triangle.

TQ3Status Q3Triangle_GetVertexPosition (
                     TQ3GeometryObject triangle,
                     unsigned long index,
                     TQ3Point3D *point);
triangle
A triangle.
index
An index into the vertices array of the specified triangle. This parameter should have the value 0, 1, or 2.
point
On exit, the position of the specified vertex.

DESCRIPTION

The Q3Triangle_GetVertexPosition function returns, in the point parameter, the position of the vertex having the index specified by the index parameter in the vertices array of the triangle specified by the triangle parameter.

Q3Triangle_SetVertexPosition

You can use the Q3Triangle_SetVertexPosition function to set the position of a vertex of a triangle.

TQ3Status Q3Triangle_SetVertexPosition (
                     TQ3GeometryObject triangle,
                     unsigned long index,
                     const TQ3Point3D *point);
triangle
A triangle.
index
An index into the vertices array of the specified triangle. This parameter should have the value 0, 1, or 2.
point
The desired position of the specified vertex.

DESCRIPTION

The Q3Triangle_SetVertexPosition function sets the position of the vertex having the index specified by the index parameter in the vertices array of the triangle specified by the triangle parameter to that specified in the point parameter.

Q3Triangle_GetVertexAttributeSet

You can use the Q3Triangle_GetVertexAttributeSet function to get the attribute set of a vertex of a triangle.

TQ3Status Q3Triangle_GetVertexAttributeSet (
                     TQ3GeometryObject triangle,
                     unsigned long index,
                     TQ3AttributeSet *attributeSet);
triangle
A triangle.
index
An index into the vertices array of the specified triangle. This parameter should have the value 0, 1, or 2.
attributeSet
On exit, a pointer to a vertex attribute set for the specified vertex.

DESCRIPTION

The Q3Triangle_GetVertexAttributeSet function returns, in the attributeSet parameter, the set of attributes for the vertex having the index specified by the index parameter in the vertices array of the triangle specified by the triangle parameter. The reference count of the set is incremented.

Q3Triangle_SetVertexAttributeSet

You can use the Q3Triangle_SetVertexAttributeSet function to set the attribute set of a vertex of a triangle.

TQ3Status Q3Triangle_SetVertexAttributeSet (
                     TQ3GeometryObject triangle,
                     unsigned long index,
                     TQ3AttributeSet attributeSet);
triangle
A triangle.
index
An index into the vertices array of the specified triangle. This parameter should have the value 0, 1, or 2.
attributeSet
The desired set of attributes for the specified vertex.

DESCRIPTION

The Q3Triangle_SetVertexAttributeSet function sets the attribute set of the vertex having the index specified by the index parameter in the vertices array of the triangle specified by the triangle parameter to the set specified in the attributeSet parameter.


© 1997 Apple Computer, Inc.

Previous | QD3D Book | Overview | Chapter Contents | Next